<?php 


//
$scripts = array();
$css = array();
$meta = array();


function addMeta($httpequiv, $content){
	global $meta;
	$meta[$httpequiv] = $content;
	return $meta;
}

function addScript($uri, $isAbsoluteUri = false){
	global $scripts;
	if($isAbsoluteUri) {
		array_push($scripts,$uri);
	} else {
		array_push($scripts, BASEURI . '/' . $uri);
	}
	return $scripts;
}


function addCss($uri, $isAbsoluteUri = false){
	global $css;
	if($isAbsoluteUri) {
		array_push($css,$uri);
	} else {
		array_push($css, BASEURI . '/' . $uri);
	}
	return $css;
}


function flushScripts(){
	global $scripts;
	foreach($scripts as $s){
		echo '<script type="text/javascript" src="' . $s . '" ></script>'. "\n";
	}

	
	$scripts = array();
}

function flushCss(){
	global $css;
	foreach($css as $s){
		echo '<link href="' . $s . '"  rel="stylesheet" type="text/css"  >' . "\n";
	}
	$css = array();
}



function flushMeta(){
	global $meta;
	foreach ($meta as $httpequiv => $content) {
    	echo '<meta http-equiv="' . $httpequiv . '" content="' . $meta[$httpequiv]  . '" >' . "\n"; 
	}
	$meta = array();

}


?>